<template>
	<view class="personBox">
		<view class="header">
			<view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
			<view class="phonBox flex-row">
				<view></view>
				<view class="phone flex-row" @click="call">
					<image src="../../static/icon/phone.png"></image>
					<text>联系我们</text>
				</view>
			</view>
			<view class="flex-row avatar">
				<image :src="headImg==''||headImg==undefined?require('../../static/icon/img_default_head.png'):headImg"></image>
				<view class="flex-col info">
					<view class="username text-ellipsis">{{name}}</view>
					<view class="level">{{userType==1?'普通用户':userType==2?'行业专家':userType==3?'合作高校':userType==4?'合作单位':userType==5?'合作院所':'合作伙伴'}}</view>
				</view>
			</view>
		</view>
		
		<view class="list flex-row mgTb40 bgff">
			<view class="flex-col laber">
				<text class="orger mgTop40">买方订单</text>
			</view>
			<view class="flex-col" @click="goOrder(0,1,'买方订单-全部')">
				<image src="../../static/icon/all.png"></image>
				<view>全部</view>
			</view>
			<view class="flex-col" @click="goOrder(1,1,'买方订单-待签约')">
				<image src="../../static/icon/dqy.png"></image>
				<view>待签约</view>
			</view>
			<view class="flex-col" @click="goOrder(5,1,'买方订单-待确认')">
				<image src="../../static/icon/ghz.png"></image>
				<view>待确认</view>
			</view>
			<view class="flex-col" @click="goOrder(6,1,'买方订单-已完成')">
				<image src="../../static/icon/ywc.png"></image>
				<view>已完成</view>
			</view>
		</view>
		<view class="list flex-row mgTb40 bgff">
			<view class="flex-col laber">
				<text class="orger mgTop40">卖方订单</text>
			</view>
			<view class="flex-col" @click="goOrder(0,2,'卖方订单-全部')">
				<image src="../../static/icon/all.png"></image>
				<view>全部</view>
			</view>
			
			<view class="flex-col" @click="goOrder(3,2,'卖方订单-待确认')">
				<image src="../../static/icon/dqr.png"></image>
				<view>待确认</view>
			</view>
			<view class="flex-col" @click="goOrder(4,2,'卖方订单-过户中')">
				<image src="../../static/icon/ghz.png"></image>
				<view>过户中</view>
			</view>
			<view class="flex-col" @click="goOrder(6,2,'卖方订单-已完成')">
				<image src="../../static/icon/ywc.png"></image>
				<view>已完成</view>
			</view>
		</view>
		<view class="list flex-row mgTb40 bgff">
			<view class="flex-col laber">
				<text class="orger mgTop40">服务机构</text>
			</view>
			<view class="flex-col" @click="goOrder(0,3,'服务机构-全部')">
				<image src="../../static/icon/all.png"></image>
				<view>全部</view>
			</view>
			
			<view class="flex-col" @click="goOrder(4,3,'服务机构-过户中')">
				<image src="../../static/icon/ghz.png"></image>
				<view>过户中</view>
			</view>
			<view class="flex-col" @click="goOrder(6,3,'服务机构-已完成')">
				<image src="../../static/icon/ywc.png"></image>
				<view>已完成</view>
			</view>
		</view>
	    <view class="guanggao text-ellipsis">我的交易管理中心</view>
	
		<view class="lists flex-row">
			<view class="flex-col mgb10" @click="goInfo(1)">
				<image src="../../static/icon/zlws.png"></image>
				<view>我的简介</view>
			</view>
			<!-- <view class="flex-col mgb10" @click="goInfo(2)">
				<image src="../../static/icon/wdcg@2x.png"></image>
				<view>我的成果</view>
			</view> -->
			<view class="flex-col mgb10" @click="goInfo(3)">
				<image src="../../static/icon/hycz@2x.png"></image>
				<view>会员充值</view>
			</view>
			<view class="flex-col mgb10" @click="goInfo(4)">
				<image src="../../static/icon/wdrz@2x.png"></image>
				<view>我的认证</view>
			</view>
			<view class="flex-col mgb10" @click="goInfo(5)">
				<image src="../../static/icon/yqhy@2x.png"></image>
				<view>邀请好友</view>
			</view>
			<!-- <view class="flex-col mgb10"  @click="goInfo(6)">
				<image src="../../static/icon/wdtd@2x.png"></image>
				<view>我的团队</view>
			</view> -->
			<view class="flex-col mgb10" @click="goInfo(7)">
				<image src="../../static/icon/zhgl@2x.png"></image>
				<view>账号管理</view>
			</view>
			<view class="flex-col mgb10" @click="goInfo(9)">
				<image src="../../static/icon/myxs.png"></image>
				<view>我的悬赏</view>
			</view>
			<view class="flex-col" @click="goInfo(8)">
				<image src="../../static/icon/xtsz@2x.png"></image>
				<view>系统设置</view>
			</view>
			<view class="flex-col" @click="goInfo(10)">
				<image src="../../static/icon/xtsz@2x.png"></image>
				<view>收件地址设置</view>
			</view>
		</view>
		
		
		
		<uni-popup ref="uniPop" type="dialog" >
			<uni-popup-phone :type="msgType" :title="title" :content="content" :before-close="true" @confirm="dialogConfirm" @close="dialogClose"></uni-popup-phone>
		</uni-popup>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				title:"服务热线",
				content:"02887078828",
				msgType: 'info',
				iStatusBarHeight:'',
				name:"",
				userType:"",
				headImg:""
			}
		},
		onShow: function() {
			this.getInfo()
		},
		mounted() {
			this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight
		},
		methods:{
			//获取个人信息
			getInfo(){
				let id = uni.getStorageSync('userId')
				if(id){
					this.$http.get('/userCenter/getUserInfoById', {id:id}).then(res => {
						if (res.code == '0') {
							this.userType = res.data.userType;
							this.name = res.data.name;
							this.headImg = res.data.headImg;
							this.certificationStatus = res.data.certificationStatus;
							uni.setStorageSync('certificationStatus', res.data.certificationStatus);
							
						}else{
							uni.showToast({
								icon:"none",
								title:res.msg
							})
						}
					})
				}else{
					uni.showModal({
					    title: '提示',
					    content: '还未登录,去登录',
					    success: function (res) {
							if (res.confirm) {
									
							        uni.reLaunch({
										url:'/pages/login/login'
									})
							    } else if (res.cancel) {
							        uni.reLaunch({
							        	url:'/pages/login/login'
							        })
							}
					        }
					})
				}
			},
			//服务热线
			call() {
				uni.makePhoneCall({
				 	
				 	// 手机号
				    phoneNumber: '02887078828', 
				
					// 成功回调
					success: (res) => {
						console.log('调用成功!')	
					},
				
					// 失败回调
					fail: (res) => {
						console.log('调用失败!')
					}
					
				  });			
			},
			/**
			 * 对话框点击确认按钮
			 */
			dialogConfirm(done) {
				console.log('点击确认');
				// 需要执行 done 才能关闭对话框
				done()
			},
			/**
			 * 对话框取消按钮
			 */
			dialogClose(done) {
				this.msgType = 'info'
				this.message = '点击了对话框的取消按钮'
				// 需要执行 done 才能关闭对话框
				done()
			},
			goInfo(index){
				if(index==1){
					uni.navigateTo({
						url:'/pages/person/info'
					})
				}else if(index==3){
					uni.navigateTo({
						url:'/pages/person/payfor'
					})
				}
				else if(index==4){
					uni.navigateTo({
						url:'/pages/person/myrz'
					})
				}
				else if(index==5){
					uni.navigateTo({
						url:'/pages/person/invite'
					})
				}
				else if(index==6){
					uni.navigateTo({
						url:'/pages/person/myteam'
					})
				}
				else if(index==7){
					uni.navigateTo({
						url:'/pages/person/account'
					})
				}
				else if(index==8){
					uni.navigateTo({
						url:'/pages/person/sysSetting'
					})
				}
				else if(index==9){
					uni.navigateTo({
						url:'/pages/order/myneed'
					})
				}
				else if(index==10){
					uni.navigateTo({
						url:'/pages/person/address'
					})
				}
			},
			goOrder(index,type,name){
				uni.navigateTo({
					url:'/pages/order/all?type='+type+'&status='+index+'&name='+name
				})
				
				
			}
		}
	}
</script>

<style scoped lang="scss">
	page{
		background: #FAFAFE;
		padding-bottom: 90upx;
		min-height: calc(100vh);
		overflow: auto;
	}
.personBox {
	        // height: var(--status-bar-height);
	        // padding-top: 44px;
	        // box-sizing: content-box;
	.lists {
		// height: 220upx;
		background: #fff;
		width: calc(100% + 0px);
		padding: 0;
		display: flex;
		flex-wrap: wrap;
		margin-top: 30upx;
		padding: 20upx 0;
		
		> view {
			text-align: center;
			list-style: none;
			color: #22222a;
			font-size: 26upx;
			flex: 0 0 calc(25% - 0upx);
			&.mgb10{
				margin-bottom: 40upx;
			}
			> image {
				width: 64upx;
				height: 64upx;
				margin: 0 auto 10upx auto;
			}
		}
	}
	.list {
		height: 100upx;
		width: calc(100% + 0px);
		padding: 30upx 0;
		display: flex;
		flex-wrap: wrap;
		background: #FFFFFF;
		.laber{
			position: relative;
			
		}
		.laber::after{
			position: absolute;
			content: '';
			width: 4upx;
			height: 100upx;
			background: rgba(214, 214, 214, 0.8);
			top:0upx;
			right: 0;
		}
		> view {
			text-align: center;
			list-style: none;
			color: #22222a;
			font-size: 26upx;
			
			flex: 0 0 calc(20% - 0upx);
			> image {
				width: 48upx;
				height: 48upx;
				margin: 0 auto 10upx auto;
			}
		}
	}
	.guanggao {
		background: url(../../static/icon/person_bg.png) no-repeat left top;
		background-size: 100% 100%;
		width: 570upx;
		margin: 30upx auto;
		height: 100upx;
		line-height: 100upx;
		color: #845222;
		font-size: 30upx;
		padding: 0 60upx;
		font-weight: bold;
	}
	.header {
		padding: 0 30upx;
		height: 270upx;
		background: url(../../static/icon/bg.png) no-repeat left top;
		background-size: 100% 100%;
		.phonBox {
			justify-content: space-between;
			align-items: center;
			.phone {
				text-align: center;
				justify-content: center;
				width: 150upx;
				height: 48upx;
				line-height: 48upx;
				background: rgba(230, 230, 230, 1);
				opacity: 0.8;
				border-radius: 8upx;
				color: #22222a;
				font-size: 20upx;
				align-items: center;
				margin-bottom: 32upx;
				margin-top: 32upx;
				> image {
					width: 30upx;
					height: 30upx;
					margin-right: 8upx;
				}
			}
		}
		.avatar {
			> image {
				width: 102upx;
				height: 102upx;
			}
			.info {
				padding-left: 29upx;

				.username {
					color: #22222a;
					font-size: 34upx;
					font-weight: bold;
					width: 150upx;
				}
				.level {
					margin-top: 26upx;
					width: 120upx;
					text-align: center;
					line-height: 34upx;
					height: 34upx;
					background: rgba(230, 230, 234, 1);
					border-radius: 8upx;
					color: #9a9a9a;
					font-size: 24upx;
				}
			}
		}
	}
	.orger{
		color: #FE580B!important;
	}
}
</style>
